package com.finance.capacity.siteDetail.capService;

import com.finance.capacity.deliveryDetail.capDao.DeliveryDetailMapper;
import com.finance.capacity.siteDetail.bean.pojo.SiteDetail;
import com.finance.capacity.siteDetail.bean.pojo.SiteDetailList;
import com.finance.capacity.siteDetail.capDao.SiteDetailMapper;
import com.finance.framework.lang.Page;
import com.finance.framework.lang.PageResultBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;


/**
 * @Author: ly
 * @Date: Created in 2017/8/24
 * @Description:
 */
@Service
public class SiteDetailService implements ISiteDetailService {
    @Autowired
    private SiteDetailMapper siteDetailMapper;
    @Autowired
    private DeliveryDetailMapper deliveryDetailMapper;

    @Override
    public List<SiteDetailList> maintainList(SiteDetailList siteDetailList) {
        PageResultBO<SiteDetailList> pageResultBO = new PageResultBO<SiteDetailList>();
        List<SiteDetailList> list = siteDetailMapper.maintainList(siteDetailList);
        return list;
    }

    @Override
    public PageResultBO<SiteDetail> capSummaryListByPage(Page page) {
        PageResultBO<SiteDetail> pageResultBO = new PageResultBO<SiteDetail>();
        List<SiteDetail> siteDetailsList = siteDetailMapper.capSummaryListByPage(page);
        pageResultBO.setTotalRecord(page.getTotalRecord());
        pageResultBO.setPageSize(page.getPageSize());
        pageResultBO.setPageNo(page.getPageNo());
        pageResultBO.setDataList(siteDetailsList);
        return pageResultBO;
    }

    @Override
    public List<SiteDetailList> exportMaintainList(SiteDetailList siteDetailList) {
        return siteDetailMapper.exportMaintainList(siteDetailList);
    }

    @Override
    public SiteDetailList getSiteCapInfo(String siteDetailId) {
        return siteDetailMapper.getSiteCapInfo(siteDetailId);
    }

    @Override
    public List<SiteDetail> exportSummaryList(SiteDetailList siteDetailList) {
        return siteDetailMapper.exportSummaryList(siteDetailList);
    }

    @Override
    public List<SiteDetail> siteCapDetail(String siteId, String siteDate) {
        return siteDetailMapper.siteCapDetail(siteId, siteDate);
    }

    @Override
    public Boolean checkSiteDetail(String id, String updateUid, int status) {

        return siteDetailMapper.checkSiteDetail(id, updateUid, status) > 0;
    }

    @Override
    public SiteDetailList getSiteDetailById(Long id) {
        return siteDetailMapper.getSiteDetailById(id);
    }

    @Override
    public BigDecimal getMoreAvgEffOrderNum(String id, String siteDate, BigDecimal avgNum) {
        return siteDetailMapper.getMoreAvgEffOrderNum(id,siteDate,avgNum);
    }

    @Override
    public BigDecimal getLessAvgEffOrderNum(String id, String siteDate, BigDecimal avgNum) {
        return siteDetailMapper.getLessAvgEffOrderNum(id,siteDate,avgNum);
    }

    @Override
    public BigDecimal getAvgEffOrderNum(String id, String siteDate) {
        return siteDetailMapper.getAvgEffOrderNum(id,siteDate);
    }
}



